package com.lgl.cli.example;

import cn.hutool.core.bean.BeanUtil;
import picocli.CommandLine;
import picocli.CommandLine.Command;
import picocli.CommandLine.Option;

/**
 * @author 良哥
 * @verison 1.0
 */

@Command(name = "main", description = "main", mixinStandardHelpOptions = true)
public class lowerCommandTest implements Runnable {
    @Option(names = {"--u", "--user"}, description = "用户名")
    public String userName = "good";

    @Override
    public void run() {
        System.out.println("userName  = " + userName);
    }


    @Command(name = "lower1", description = "子命令1", mixinStandardHelpOptions = true)
    static class lower1 implements Runnable {
        @Override
        public void run() {
            System.out.println("子命令1的run");
        }
    }

    @Command(name = "lower2", description = "子命令2", mixinStandardHelpOptions = true)
    static class lower2 implements Runnable {
        @Override
        public void run() {
            System.out.println("子命令2的run");
        }
    }


    public static void main(String[] args) {

        String[] mineArgs = new String[]{"--help"};
        
        new CommandLine(new lowerCommandTest())
                .addSubcommand(new lower1())
                .addSubcommand(new lower2())
                .execute(mineArgs);
    }
}
